<?python
from onlineapidoc.model import SPACE_STATUS_BEHIND_SCHEDULE, lang_codes, LANG_CHN
from turbogears.i18n.format import format_date
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
    py:extends="'../master.kid'">

<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
    <title>Online API Doc Dashboard</title>
	<link href="/static/css/dashboard.css" media="screen" rel="Stylesheet" type="text/css" /> 
</head>

<body>

<a href="#" onclick="toggle('new_space'); clr('ta_new_space');fcs('tf_desc'); return false;">new space</a>
<div id="new_space" style="display: none;">
<form id="form_new_space" action="/space/new_space" method="post">
<table>
<tr>
<td width="120"><b>Name</b></td>
<td><input id="tf_desc" type="text" name="name" size="50" /></td>
</tr>
<tr>
<td><b>Language</b></td>
<td>
<select name="language">
<option py:for="k,v in lang_codes.items()" value='$k' selected="${(None, '')[k == LANG_CHN]}">
${v}
</option>
</select>
</td>
</tr>
<tr>
<td colspan="2"><b>Description</b></td>
</tr>
<tr>
<td colspan="2">
<textarea id="ta_new_space" rows="4" name="description" cols="72"></textarea>
</td>
</tr>
</table>
<a href="#" onclick="submit('form_new_space'); return false;">add</a>
<a href="#" onclick="toggle('new_space'); return false;">cancel</a>
</form>
</div>

<div class="recentview">
<table class="spaceview" cellspacing="0" width="50%">
<tr>
<td><b>Recently Updated</b></td>
<td>&nbsp;</td>
</tr>
<tr>
<th>Title</th>
<th width="35%">Author</th>
</tr>
<tr py:for="up_page in last_updated">
<td><span><a href="/page/page_view/$up_page.id" py:content="up_page.name">Title</a></span></td>
<td><a href="mailto:$up_page.last_edit_user.email_address" py:content="up_page.last_edit_user.display_name">Author</a>
(<span py:content="format_date(up_page.last_edit_time, date_format='%b/%d', time_format=' %H:%M')">Last edit time</span>)
</td>
</tr>
</table>
</div>

<table class="spaceview" cellspacing="0">
<tr>
<td><b>Space List</b></td>
<td>&nbsp;</td>
</tr>
<tr>
<th>Name</th>
<th>Operations</th>
</tr>
<tr py:for="space in spaces">
<td><a href="/space/$space.id" py:content="space.name" width="15%" title="${XML(space.description)}">Name</a></td>
<td width="60%">
<a href="/space/space_setting/$space.id">Attribute</a>
<a py:if="'root' in tg.identity.groups" href="/space/space_delete/$space.id">Delete</a>
<a py:if="'root' in tg.identity.groups" href="/space/space_translate/$space.id">Translate</a>
<a py:if="'root' in tg.identity.groups" href="/space/space_duplicate/$space.id">Duplicate</a>
<a py:if="not tg.identity.anonymous and tg.identity.user.id == space.admin.id or 'root' in tg.identity.groups" href="/space/space_chm/$space.id">CHM</a>
</td>
</tr>
</table>

</body>
</html>
